import { ipcRenderer } from 'electron';

export default function(store) {
    ipcRenderer.on('toggle-menu', e => {
        store.dispatch('toggleMenu', null);
    });

    ipcRenderer.on('lockdown', e => {
        store.dispatch('lockdown', null);
    });

    ipcRenderer.on('directory-selected', (e, arg) => {
        store.dispatch('selectDirectory', arg);
    });

    ipcRenderer.on('image-selected', (e, arg) => {
        if (store.state.App.playing) {
            store.dispatch('selectImage', arg);
        } else {
            store.dispatch('selectImage', {});
        }
    });

    ipcRenderer.on('window-size-changed', (e, arg) => {
        store.dispatch('setContentSize', arg);
    });

    ipcRenderer.on('enter-full-screen', e => {
        store.dispatch('enterFullScreen');
    });
    ipcRenderer.on('leave-full-screen', e => {
        store.dispatch('leaveFullScreen');
    });

    ipcRenderer.on('set-configuration', (e, arg) => {
        store.dispatch('setConfig', arg);
    });
}
